//
// Decompiled by Jadx - 394ms
//
package dj;

import android.content.Context;
import android.os.Handler;
import com.tonyodev.fetch2.database.e;
import com.tonyodev.fetch2.database.h;
import com.tonyodev.fetch2.fetch.c;
import com.tonyodev.fetch2.fetch.d;
import com.tonyodev.fetch2.fetch.f;
import com.tonyodev.fetch2.fetch.g;
import com.tonyodev.fetch2core.m;
import dk.a;
import dk.b;
import es.l;
import java.util.LinkedHashMap;

public final class d$a {
    public static c a(e eVar) {
        d.b bVar;
        synchronized (d.a) {
            LinkedHashMap linkedHashMap = d.b;
            d.a aVar = (d.a) linkedHashMap.get(eVar.b);
            if (aVar != null) {
                bVar = new d.b(eVar, aVar.a, aVar.b, aVar.c, aVar.d, aVar.e, aVar.f, aVar.g);
            } else {
                m mVar = new m(eVar.b, eVar.q);
                g gVar = new g(eVar.b);
                e eVar2 = eVar.p;
                if (eVar2 == null) {
                    Context context = eVar.a;
                    eVar2 = new com.tonyodev.fetch2.database.g(context, eVar.b, eVar.h, new a[]{new b(2), new b(5), new b(4), new b(1), new b(0), new b(3)}, gVar, eVar.m, new com.tonyodev.fetch2core.b(context, com.tonyodev.fetch2core.g.m(context)));
                }
                h hVar = new h(eVar2);
                com.tonyodev.fetch2.helper.a aVar2 = new com.tonyodev.fetch2.helper.a(hVar, 1);
                ct.b bVar2 = new ct.b(eVar.b);
                am.c cVar = new am.c(eVar.b, aVar2);
                String str = eVar.b;
                Handler handler = d.c;
                f fVar = new f(str, cVar, aVar2, handler);
                d.b bVar3 = new d.b(eVar, mVar, hVar, aVar2, cVar, handler, bVar2, fVar);
                linkedHashMap.put(eVar.b, new d.a(mVar, hVar, aVar2, cVar, handler, bVar2, fVar, bVar3.a));
                bVar = bVar3;
            }
            m mVar2 = bVar.d;
            synchronized (mVar2.a) {
                if (!mVar2.b) {
                    mVar2.c++;
                }
                l lVar = l.a;
            }
        }
        e eVar3 = bVar.c;
        return new c(eVar3.b, eVar3, bVar.d, bVar.f, bVar.b, eVar3.h, bVar.g, bVar.e);
    }
}
